//
//  BoutiqueCell.m
//  NewNest
//
//  Created by hesiyao on 16/1/17.
//  Copyright © 2016年 www.lanou3g.com蓝鸥科技. All rights reserved.
//

#import "BoutiqueCell.h"
#import <UIColor+Wonderful.h>
@implementation BoutiqueCell

- (void)dealloc
{
    [_titleLabel release];
    [_img release];
    [_styleLabel release];
    [_squareLabel release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.img = [[UIImageView alloc] init];
        _img.layer.cornerRadius = 5;
        _img.clipsToBounds = YES;
        // 图片按比例放置
        _img.contentMode = UIViewContentModeScaleAspectFill;
        [self.contentView addSubview:_img];
        [_img release];
        
        self.titleLabel = [[UILabel alloc] init];
        _titleLabel.numberOfLines = 0;
        //        _titleLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_titleLabel];
        [_titleLabel release];
        
        self.styleLabel = [[UILabel alloc] init];
        _styleLabel.font = [UIFont systemFontOfSize:14];
        _styleLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:_styleLabel];
        [_styleLabel release];
        
        self.squareLabel = [[UILabel alloc] init];
        _squareLabel.font = [UIFont systemFontOfSize:14];
        _squareLabel.textColor = [UIColor grayColor];
        [self.contentView addSubview:_squareLabel];
        [_squareLabel release];
        
        self.priceLabel = [[UILabel alloc] init];
//        _priceLabel.backgroundColor = [UIColor aquamarine];
        _priceLabel.textColor = [UIColor deepSkyBlue];
        _priceLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:_priceLabel];
        [_priceLabel release];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.img.frame = CGRectMake(20, 10, self.contentView.frame.size.width - 40, self.frame.size.height - 75);
    self.titleLabel.frame = CGRectMake( 20, _img.frame.origin.y + _img.frame.size.height + 5 , _img.frame.size.width - 40, 30);
    self.styleLabel.frame = CGRectMake(20, _titleLabel.frame.origin.y + _titleLabel.frame.size.height + 5, self.contentView.frame.size.width / 4, 20);
    self.squareLabel.frame = CGRectMake(30 + _styleLabel.frame.size.width, _styleLabel.frame.origin.y, _styleLabel.frame.size.width, _styleLabel.frame.size.height);
    self.priceLabel.frame = CGRectMake(self.contentView.frame.size.width - 80, _titleLabel.frame.origin.y , 70, _titleLabel.frame.size.height + _styleLabel.frame.size.height);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
